{extend name="pub/base" /}
{block name="head"}
<title>编辑作者</title>
<style>
    #formBasForm {
        max-width: 700px;
        margin: 30px auto;
    }

    #formBasForm .layui-form-item {
        margin-bottom: 25px;
    }
</style>
{/block}
{block name="main"}
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <!-- 表单开始 -->
            <form class="layui-form" id="formBasForm" lay-filter="formBasForm">
                <input type="hidden" name="id" value="{$author.id}">
                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">昵称:</label>
                    <div class="layui-input-block">
                        <label>
                            <input name="author_name" value="{$author.author_name}" class="layui-input"
                                   lay-verType="tips" lay-verify="required" required/>
                        </label>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">密码:</label>
                    <div class="layui-input-block">
                        <input name="password" placeholder="不需要改密码可留空" class="layui-input"
                               lay-verType="tips" lay-verify="password" />
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">邮箱:</label>
                    <div class="layui-input-block">
                        <label>
                            <input name="email" value="{$author.email}" class="layui-input"
                                   lay-verType="tips" lay-verify="required" required/>
                        </label>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">状态：</label>
                    <div class="layui-input-block">
                        <select name="status" lay-verType="tips" lay-verify="required" required>
                            <option value="1" {$author.status==1?"selected":""}>
                                正常
                            </option>
                            <option value="0" {$author.status==0?"selected":""}>
                                锁定
                            </option>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-filter="formBasSubmit" lay-submit>&emsp;提交&emsp;</button>
                        <button type="reset" class="layui-btn layui-btn-primary">&emsp;重置&emsp;</button>
                    </div>
                </div>
            </form>
            <!-- //表单结束 -->
        </div>
    </div>
</div>
{/block}
{block name="js"}
<script>
    layui.use(['layer', 'form', 'laydate', 'upload'], function () {
        var $ = layui.jquery;
        var form = layui.form;

        /* 监听表单提交 */
        form.on('submit(formBasSubmit)', function (data) {
            $.ajax({
                url:"{:adminurl('edit')}",
                type:'post',
                data:$('form').serialize(),
                success(res) {
                    subResHandle(res)
                }
            })
            return false;
        });
    });
</script>
{/block}